<template>
	<view class="layout">
		<!-- 自定义头部组件 -->
	    <view class="navBar">
			<!-- 占位 -->
	    	<view class="statueBar" :style="{height:getStatusBarHeight() + 'px'}"></view> 
			<view class="titleBar" :style="{height:getTitleBarHeight()+'px',marginLeft:getLeftIconLeft()+'px'}">
				<view class="title">{{ title }}</view>
				<navigator url="/pages/search/search">
					<view class="search">
						<uni-icons type="search" size="18" color="#888"></uni-icons>
						<text class="text"> 搜索 </text>
					</view>
				</navigator>
			</view>
	    </view>
		<!-- 因为标题搜索部分是用了固定定位，所以会盖住banner部分，因此这部分依然占位 -->
		<view class="fill" :style="{height:getStatusBarHeight()+getTitleBarHeight()+'px'}"></view>
	</view>
</template>

<script setup>
    import { ref } from 'vue';
    import { getStatusBarHeight,getTitleBarHeight,getLeftIconLeft } from "@/utils/system.js"
	defineProps({
		title:{
			type:String,
			default:'',
		}
	})
	
</script>

<style lang="scss" scoped>
    .layout {
		.navBar {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			z-index: 10;
			background: linear-gradient(to bottom,transparent,#fff 400rpx),linear-gradient(to right, #beecd8 20%, #f4e2d8);
			.statueBar {
				// border: 1px solid red;
			}
			.titleBar {
				display: flex;
				padding: 0 30rpx;
				align-items: center;
				.title {
					font-size: 44rpx;
					font-weight: 700;
					color: $text-font-color-1;
				}
				.search {
					width: 220rpx;
					height: 50rpx;
					border-radius: 60rpx;
					background-color: rgba(255, 255, 255, 0.4);
					border: 1px solid #fff;
					margin-left: 30rpx;
					color: #999;
					font-size: 28rpx;
					display: flex;
                    align-items: center;
					padding: 0 5rpx;
					.text {
						padding-left: 10rpx;
					}
   				}
			}
		}
		.fill {
			
		}
	}
</style>